package org.example;
// 删除有序数组中的重复项 II
public class topic80 {
    public int removeDuplicates(int[] nums) {
        int size = nums.length;
        int slow = 2;
        int fast=2;
        if (size <= 2) {
            return size;
        }
        while (fast<size) {
            if (nums[slow-2] != nums[fast]){
                nums[slow] = nums[fast];
                ++slow;
            }
            ++fast;

        }
        return slow;
    }

}
